package com.rockcent.mall.lib.domain;

import com.rockcent.common.domain.IDEntityMall;
import com.rockcent.common.domain.enumclass.Whether;
import com.rockcent.mall.lib.domain.enumclass.ProtocolType;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.*;

/**
 * Created by zhangjh on 2016/12/20.
 */
@Table(name = "mall_protocol")
@Entity
@DynamicUpdate
@DynamicInsert
public class MallProtocol extends IDEntityMall {

    @Column(columnDefinition = "varchar(100) comment '协议标题'")
    private String title;

    @Column(columnDefinition = "text comment '协议文本'")
    private String content;

    @Column(columnDefinition = "bigint comment '平台ID'")
    private Long mallId;

    @Column(columnDefinition = "bigint comment '版本号'")
    private Long versionNo = 1L;

    @Column(columnDefinition = "varchar(20) comment '是否过期'")
    @Enumerated(EnumType.STRING)
    private Whether expire = Whether.NO;

    @Column(columnDefinition = "varchar(30) comment '协议类型'")
    @Enumerated(EnumType.STRING)
    private ProtocolType protocolType;

    public Whether getExpire() {
        return expire;
    }

    public void setExpire(Whether expire) {
        this.expire = expire;
    }

    public Long getMallId() {
        return mallId;

    }

    public void setMallId(Long mallId) {
        this.mallId = mallId;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public Long getVersionNo() {
        return versionNo;
    }

    public void setVersionNo(Long versionNo) {
        this.versionNo = versionNo;
    }

    public ProtocolType getProtocolType() {
        return protocolType;
    }

    public void setProtocolType(ProtocolType protocolType) {
        this.protocolType = protocolType;
    }

    @Override
    public String toString() {
        return "MallProtocol{" +
                "title='" + title + '\'' +
                ", id=" + id +
                ", content='" + content + '\'' +
                ", dateCreated=" + dateCreated +
                ", mallId=" + mallId +
                ", versionNo=" + versionNo +
                ", lastUpdated=" + lastUpdated +
                ", expire=" + expire +
                ", isDelete=" + isDelete +
                ", protocolType=" + protocolType +
                ", version=" + version +
                '}';
    }
}
